package com.example.hms.service.servicelmpl;

import com.example.hms.entity.SystemLog;
import com.example.hms.dao.SystemLogDao;
import com.example.hms.service.SystemLogService;
import com.example.hms.util.Result;
import com.example.hms.util.ResultSubmit;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.text.SimpleDateFormat;

@Service
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED, rollbackFor = Exception.class)
public class SystemLogServiceImpl implements SystemLogService {
    @Resource
    private SystemLogDao systemLogDao;

    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    @Override
    public Result selectAllSystemLog(SystemLog systemLog) {
        return ResultSubmit.success(systemLogDao.selectAllSystemLog(systemLog));
    }

    @Override
    public void insert(SystemLog systemLog) {
        systemLogDao.insert(systemLog);
    }
}
